package io.github.weiranyi.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/*
    1.类名任意：建议Listener结尾，不需要实现接口或者继承指定类
    2.方法名任意：必须有个参数是Message
*/
@Component
public class RabbimtMQListener {
    @RabbitListener(queues = "boot_queue1")
    public void listenerQueue(Message message){
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.println(deliveryTag);
        System.out.println(new String(message.getBody()));
        System.out.println("---------------------------");
    }
}
